package cn.wolfcode.wolf2w.business.util;

import java.util.Calendar;
import java.util.Date;

public class DateUtil {
    //获取传入日期对象的当天的最后一分一秒
    public static Date getEndDate(Date date){
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.set(Calendar.HOUR,23);
        calendar.set(Calendar.MINUTE,59);
        calendar.set(Calendar.SECOND,59);
        return calendar.getTime();
    }

    //计算两个对象之间相差的秒数
    public static long getDateBetween(Date d1, Date d2){
        return Math.abs(d1.getTime()-d2.getTime())/1000;
    }

}